#ifndef __CPPTUTORSOCKETSERVER_H__
#define __CPPTUTORSOCKETSERVER_H__

#include "cppTutorSocket.h"
#include "cppTutorGlobals.h"
#include "cppTutorSocketException.h"

#include <string>

#ifdef WIN32
    //#include <winsock2.h>
    //#include <stdio.h>
    //#pragma comment(lib,"ws2_32.lib")
#else
    #include <sys/types.h>
    #include <stdlib.h>
    #include <unistd.h>
    #include <sys/socket.h>
    #include <netinet/in.h>
    #include <string.h>
    #include <netdb.h>
    #include <stdio.h>
#endif

//#ifdef SOCKET_UDP
class CcppTutorSocketServer
{
    private:
        int sock, length, n;
#ifdef WIN32
#else
        socklen_t fromlen;
#endif
        struct sockaddr_in server;
        struct sockaddr_in from;
        char buf[1024];
        std :: string m_strPort;
    public:
        CcppTutorSocketServer ();
        CcppTutorSocketServer (std :: string);
       ~CcppTutorSocketServer ();

        void error(const char *msg);
        int udp_server (int argc1, char *argv1[]);
};
//#endif //SOCKET_UDP

//#ifdef SOCKET_TCP

class ServerSocket : private Socket
{
    public:
        ServerSocket ( int port );
        ServerSocket (){};
        virtual ~ServerSocket();

        const ServerSocket& operator << ( const std::string& ) const;
        const ServerSocket& operator >> ( std::string& ) const;

        void accept ( ServerSocket& );
};
//#endif //SOCKET_TCP

#endif //__CPPTUTORSOCKETSERVER_H__

